<template>
	<view class="wrapper">
		<view class="tabItem" :class="{active : currentCode == item.code}" v-for="(item,index) in tabs" :key="item.code" @click="change(item.code)">
			{{item.lable}}
		</view>
	</view>
</template>

<script>
	export default {
		name: '',
		data() {
			return {
				tabs:[
					{
						lable : '短租',
						code : 1
					},
					// {
					// 	lable : '长租',
					// 	code : 2
					// },
					// {
					// 	lable : '豪车租赁',
					// 	code : 3
					// }
				],
			}
		},
		props: {
			currentCode: {
			   type: Number,
			   default: 1
			}
		},
		mounted() {

		},
		methods: {
            change(code) {
				this.currentCode = code;
				this.$emit('selectedItemCode', code);
			}
		}
		
	}
</script>

<style lang="scss" scoped>
	.wrapper {
		display: flex;
		// justify-content: space-between;
		align-items: center;
		padding: 20upx;
	}
	.tabItem {
		display: inline-block;
		color: $text-color-33;
		font-size: 24upx;
		font-weight: bold;
		height: 60upx;
		line-height: 60upx;
		text-align: center;
		padding: 0 20upx;
		margin-right: 20upx;
		&.active {
			color: $main-color;
			font-size: 28upx;
			border: 2upx solid $main-color;
			border-radius: 8upx;
		}
	}
</style>
